﻿#ifndef CELESTIAL_BODY_H
#define CELESTIAL_BODY_H
#include <osg/MatrixTransform>
struct SCelestialBodyEle
{
	std::string m_strID;
	std::string m_strName;
	std::string m_strParentID;
	double m_dBodyRadius;//m
	double m_dRotationPeriod;//天
	double m_dOrbitRadius;//m
	double m_dRevolutionPeriod;//天
	std::string m_strImage;
	SCelestialBodyEle(std::string strID="",
		std::string strName="",
		std::string strParentID="",
		double dBodyRadius=0,
		double dRotationPeriod=0,
		double dOrbitRadius=0,
		double dRevolutionPeriod=0,
		std::string strImage="")
		:m_strID(strID)
		,m_strName(strName)
		,m_strParentID(strParentID)
		,m_dBodyRadius(dBodyRadius)
		,m_dRotationPeriod(dRotationPeriod)
		,m_dOrbitRadius(dOrbitRadius)
		,m_dRevolutionPeriod(dRevolutionPeriod)
		,m_strImage(strImage)
	{
	}
};
class CCelestialBody : public osg::Group
{
public:
	CCelestialBody(SCelestialBodyEle stCelestialBodyEle);

	~CCelestialBody();

	const SCelestialBodyEle& getCelestialBodyEle(){return m_stCelestialBodyEle;}

    void setVisible(bool bVisible){m_bVisible=bVisible;}

	bool getVisible(){return m_bVisible;}

	void setPosition(const osg::Vec3& vecPosition){m_vecPosition = vecPosition;}

	const osg::Vec3& getPosition(){return m_vecPosition;} 

	void setPosture(const osg::Vec3& vecPosture){m_vecPosture = vecPosture;}

	const osg::Vec3& getPosture(){return m_vecPosture;} 

protected:
	virtual void traverse(osg::NodeVisitor& nv);

protected:
	SCelestialBodyEle m_stCelestialBodyEle;
	bool m_bVisible;
	osg::Vec3 m_vecPosition;
	osg::Vec3 m_vecPosture;
	osg::ref_ptr<osg::MatrixTransform> m_rpMT;

};
#endif CELESTIAL_BODY_H